package uk.ac.glasgow.demosocs.tests;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.*;


//these are some sample imports that will need to be changed based on the test case.
import uk.ac.glasgow.demosocs.*;
import uk.ac.glasgow.demosocs.impl.*;
import uk.ac.glasgow.demosocs.users.*;

import java.util.Date;
import java.util.Set;

public class NominateCandidate{

//instance variables definition;
	VotingSystem vs;

	// initialise the instance variables
	@Before
	public void setUp() throws Exception{
		vs = new VotingSystemStub();
		vs.createElection("ClassRep", "P");
		Date nominations = new Date("19/2/12");
		Date start = new Date("20/2/12");
		Date end = new Date("21/2/12");
		vs.editElection(nominations,start, end, "001");
		vs.nominateCandidate("001");
	}

	//set the instance variables to null
	@After
	public void tearDown() throws Exception{
		vs = null;
	}


	// test that the user can Nominate a Candidate
	@Test 
	public void NominateCandidateTest(){
		vs.setCurrentUser("001","pass");
		vs.setCurrentElection("001");
		Set<Election> elections = vs.getNominations();
		Election e = vs.getCurrentElection();
		assertEquals(true,elections.contains(e));
	}
}